#ifndef PlayWidget_H
#define PlayWidget_H

#include <QProcess>
#include <QWidget>
#include <QEvent>
#include <QLabel>
#include <QVBoxLayout>
#include <QMap>

#include "EmotionInterface.h"

namespace Ui {
class PlayWidget;
}

class PlayWidget : public QWidget
{
    Q_OBJECT

public:
    explicit PlayWidget(QWidget *parent = nullptr);
    ~PlayWidget();

    void showWords(const QString &text);
    void hideWords();
    
    void set_Video_flag(bool);
    void set_play_mode(int mode);
    void setVideoList(QStringList &);

public slots:
    void video_shutDown(int exitCode, QProcess::ExitStatus exitStatus);
    void work();
    void playVideoFromFile(QString filePath);
    // void stopVideo();




signals:
    void sendVideoLabel(EmotionInterface::EmoMode label);
    void sendDataLabel(EmotionInterface::EmoMode label, int playMode, bool is_begin);
    void videoPlayer_shutDown();


protected:
    void keyPressEvent(QKeyEvent *event) override;
    void mouseDoubleClickEvent(QMouseEvent *event) override;

private:
    EmotionInterface::EmoMode getLabelFromFile(QString &);

private:
    Ui::PlayWidget *ui;
    QProcess *mpvProcess;
    // QMap<QString,EmotionInterface::EmoMode> videoMap;
    QList<QString> videoList;
    QList<EmotionInterface::EmoMode> labelList;

    QStringList processArg;

    // 播放视频
    bool showVideo_flag;
    // 显示文字
    bool showLabel_flag;
    // 播放任务标志
    bool taskEnd_flag;
    // 正在播放视频
    bool videoPlaying;
    int video_index;
    int trainVideoNum;
    int predictVideoNum;
    int playMode;


};

#endif // PlayWidget_H
